Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically focus inputs, or the primary button, in modals. #2974

Merged
merged 21 commits into from
Aug 15, 2024

Conversation

psybers
Copy link
Contributor

@psybers psybers commented Jul 3, 2024

Working so that modals will automatically focus the first input, or for confirmation-style modals, autofocus the "primary" button so you can just hit ENTER when it pops up (or ESC).

There are two React Aria button refactoring PRs remaining. It looks like #2915 has no overlap. This PR should be merged after #3163 as it conflicts on one file:

  • packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx

Copy link

netlify bot commented Jul 3, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 5101582
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66bd19145cc4f1000846cca3
😎 Deploy Preview https://deploy-preview-2974.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Jul 3, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 4.94 MB → 4.95 MB (+1.42 kB) +0.03%
Changeset
File Δ Size
src/components/modals/ConfirmTransactionDelete.tsx 📈 +117 B (+6.38%) 1.79 kB → 1.91 kB
src/components/modals/ConfirmUnlinkAccount.tsx 📈 +115 B (+5.66%) 1.98 kB → 2.1 kB
src/components/modals/ConfirmTransactionEdit.tsx 📈 +121 B (+3.40%) 3.48 kB → 3.6 kB
src/components/modals/GoCardlessInitialise.tsx 📈 +117 B (+3.05%) 3.75 kB → 3.87 kB
src/components/schedules/ScheduleLink.tsx 📈 +107 B (+3.01%) 3.47 kB → 3.57 kB
src/components/reports/SaveReportDelete.tsx 📈 +39 B (+2.97%) 1.28 kB → 1.32 kB
src/components/manager/ImportYNAB4.tsx 📈 +33 B (+1.08%) 2.98 kB → 3.01 kB
src/components/manager/ImportYNAB5.tsx 📈 +33 B (+1.07%) 3 kB → 3.03 kB
src/components/modals/SimpleFinInitialise.tsx 📈 +29 B (+1.00%) 2.84 kB → 2.87 kB
src/components/manager/ImportActual.tsx 📈 +33 B (+0.96%) 3.37 kB → 3.41 kB
src/components/schedules/PostsOfflineNotification.jsx 📈 +31 B (+0.88%) 3.45 kB → 3.48 kB
src/components/manager/WelcomeScreen.tsx 📈 +33 B (+0.80%) 4.01 kB → 4.04 kB
src/components/modals/CreateAccountModal.tsx 📈 +119 B (+0.80%) 14.57 kB → 14.69 kB
src/components/modals/ConfirmCategoryDelete.tsx 📈 +36 B (+0.75%) 4.7 kB → 4.74 kB
src/components/select/RecurringSchedulePicker.jsx 📈 +115 B (+0.69%) 16.25 kB → 16.37 kB
src/components/accounts/AccountSyncCheck.jsx 📈 +35 B (+0.69%) 4.95 kB → 4.99 kB
src/components/modals/GoCardlessExternalMsg.tsx 📈 +60 B (+0.65%) 8.97 kB → 9.03 kB
src/components/accounts/Reconcile.jsx 📈 +29 B (+0.62%) 4.59 kB → 4.62 kB
src/components/modals/MergeUnusedPayees.jsx 📈 +33 B (+0.51%) 6.27 kB → 6.3 kB
src/components/modals/CloseAccountModal.tsx 📈 +43 B (+0.45%) 9.3 kB → 9.35 kB
src/components/schedules/ScheduleDetails.jsx 📈 +121 B (+0.41%) 28.97 kB → 29.08 kB
src/components/accounts/Account.jsx 📈 +27 B (+0.06%) 42.65 kB → 42.68 kB
src/components/modals/ImportTransactions.jsx 📈 +31 B (+0.06%) 50.19 kB → 50.22 kB
src/components/mobile/transactions/TransactionEdit.jsx 📉 -1 B (-0.00%) 32.51 kB → 32.51 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.22 MB → 3.22 MB (+1.33 kB) +0.04%
static/js/wide.js 241.46 kB → 241.51 kB (+56 B) +0.02%
static/js/ReportRouter.js 1.24 MB → 1.24 MB (+39 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 77.55 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/AppliedFilters.js 27.55 kB 0%

Copy link
Contributor

github-actions bot commented Jul 3, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.14 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.14 MB 0%

@psybers psybers changed the title [WIP] Automatically focus inputs, or the primary button, in modals. Automatically focus inputs, or the primary button, in modals. Jul 3, 2024
@MatissJanis
Copy link
Member

This is cool, but @joel-jeremy is currently refactoring the Button component to react-aria. So perhaps lets hold off on this until his migration is complete?

@psybers psybers changed the title Automatically focus inputs, or the primary button, in modals. [WIP] Automatically focus inputs, or the primary button, in modals. Jul 10, 2024
@youngcw youngcw removed the 🚧 WIP label Jul 17, 2024
@psybers psybers changed the title [WIP] Automatically focus inputs, or the primary button, in modals. Automatically focus inputs, or the primary button, in modals. Jul 18, 2024
@psybers psybers changed the title Automatically focus inputs, or the primary button, in modals. [WIP] Automatically focus inputs, or the primary button, in modals. Jul 18, 2024
Copy link
Contributor

👋 Hi! It looks like this PR has not had any changes for a week now. Would you like someone to review this PR? If so - please remove the "[WIP]" prefix from the PR title. That will let the community know that this PR is open for a review.

@psybers
Copy link
Contributor Author

psybers commented Aug 6, 2024

@joel-jeremy Do you have all of the react button refactoring PRs in now?

@psybers psybers changed the title [WIP] Automatically focus inputs, or the primary button, in modals. Automatically focus inputs, or the primary button, in modals. Aug 7, 2024
@matt-fidd
Copy link
Contributor

@psybers I believe the relevant react aria button PRs are in now, there's one tiny conflict left.

@psybers
Copy link
Contributor Author

psybers commented Aug 13, 2024

@matt-fidd Conflicts resolved.

>
Delete
</Button>
<InitialFocus>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psybers - I'm not questioning you on this, just a learning moment for me as I get to better grips with React. Why is this one wrapped in instead of an autofocus prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the focus() call on the element, after a short delay. Which is needed in some cases.

@matt-fidd
Copy link
Contributor

Will leave this for a day for any other opinions before I merge it.

@matt-fidd matt-fidd merged commit 5e3485a into actualbudget:master Aug 15, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants